package com.zc.designmodel.structural.flyweight;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: zhuCan
 * @date: 2020/4/14 13:51
 * @description:
 */
public class CircleFlyweight {
  private static final Map<Circle.Color,Circle> circleMap = new HashMap<>();

  public Circle getCircle(Circle.Color color){
    if (circleMap.get(color)==null){
      circleMap.put(color,new Circle(color));
    }
    return circleMap.get(color);
  }
}
